import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Collections;

public class oiltop {

	/**
	 * @param args
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException {
		// ref.
		// http://docs.oracle.com/javase/tutorial/networking/urls/readingWriting.html
		final String oiltop_url = "http://www.oiltop.co.kr/list_category_2.html?code_1=1&code_2=";

		URL oracle = new URL(oiltop_url);
		URLConnection yc = oracle.openConnection();
		BufferedReader in = new BufferedReader(new InputStreamReader(
				yc.getInputStream(), "EUC-KR"));

		String inputLine;
		//int cnt = 0;
		ArrayList<Product> al = new ArrayList<Product>();
		while ((inputLine = in.readLine()) != null) {
			if (inputLine.contains("product_t")) {
				// <a href="#" onclick="setPosition('4')"><span class="product_t">렙솔 Turbo Life 0W30<br>(100%합성엔진오일)</span><br>
				// <font color=red>19,000원/1리터</font><br>
				// </a>
				String product = inputLine.substring(inputLine.indexOf("product_t") + 11, inputLine.indexOf("</"));
				product = product.replace("<br>", " ");
				product = product.replace("<Br>", " ");

				Product p = new Product(product);

				inputLine = in.readLine();
				product = inputLine.substring(inputLine.indexOf(">") + 1, inputLine.indexOf("</"));

				String[] pars = product.split("/");
				if (pars.length < 2) {
					continue;
				}
				pars[0] = pars[0].substring(0, pars[0].length() - 1).replace(",", "");

				float won = Float.parseFloat(pars[0]);
				float div;
				try {
					if (pars[1].contains("리터")) {
						div = Float.parseFloat(pars[1].substring(0, 1));
					} else if (pars[1].contains("ml")) {
						div = Float.parseFloat(pars[1].substring(pars[1].indexOf("ml") - 3, pars[1].indexOf("ml")));
						div /= 1000;
					} else {
						// 1QT
						div = 0.946f;
					}
				} catch (NumberFormatException e) {
					e.printStackTrace();
					continue;
				}

				p.wonPerLiter = (int) (won / div);

				inputLine = in.readLine(); // for </a>
				inputLine = in.readLine(); // for sold out

				if (inputLine.contains("품절") || inputLine.contains("단종")) {
					p.available = false;
				}

				al.add(p);
				// System.out.println((++cnt) + " " + p);
				// return;
			}
		}
		in.close();

		String opt = "W20";
		if (args.length > 0) {
			opt = args[0];
		}
		Collections.sort(al);
		for (int i = 0; i < al.size(); i++) {
			if (al.get(i).name.contains(opt)) {
				System.out.println(al.get(i));
			}
		}
	}

}

class Product implements Comparable<Product> {
	Integer wonPerLiter;
	String name;
	boolean available;

	public Product(String name) {
		this.name = name;
		this.available = true;
	}

	@Override
	public String toString() {
		boolean chk = false;
		byte[] orig = this.name.getBytes();
		byte[] b = new byte[35];
		for (int i = 0; i < b.length; i++) {
			if(orig.length - 1 < i) {
				chk=true;
				break;
			}
			b[i]=orig[i];
		}
		if(!chk) {
			b[b.length-1] = '.';
			b[b.length-2] = '.';
			b[b.length-3] = '.';
		}
		this.name = new String(b);
		
		String price = wonPerLiter.toString();
		if(price.length() == 4) {
			price = " " + price;
		}
		if (!available) {
			return "X " + this.name + "\t: " + price + "원/1L";
			// return "";
		} else {
			return "  " + this.name + "\t: " + price + "원/1L";
		}
	}

	@Override
	public int compareTo(Product o) {
		return this.wonPerLiter.compareTo(o.wonPerLiter);
	}
}
